package com.mouse.multi.test;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import org.junit.Test;

public class Student {
    @Test
    public void test1() throws Exception {
        //https://www.23txt.com/files/article/html/24/24483/
        long t1 = System.currentTimeMillis();
        Document document = Jsoup.connect("https://m.23txt.com/files/article/html/24/24483/")
                .get();
        Elements elements = document.select("ul[class=chapter]");
//        System.out.println(elements);
        Element element = elements.get(0);
        Elements elements1 = element.select("a");
        int index = 0, desc = 1;
        for (int i = 0; i < elements1.size(); i++) {
            index = desc == 1 ? elements1.size() - 1 - i : i;
            Element element1 = elements1.get(index);
            System.out.println(element1.attr("href"));
            System.out.println(element1.attr("title"));
        }
        System.out.println(System.currentTimeMillis() - t1);
        System.out.println(document);
    }
}
